# Copyright (c) 2020 Presto Labs Pte. Ltd.
# Author: leon

from absl import app, flags

import pandas

FLAGS = flags.FLAGS


def simple_stats_and_print(feed_stats_df):
  percentiles = [.1, .2, .3, .4, .5, .6, .7, .8, .9, .99]
  print(feed_stats_df['avg_message_time_diff/1000000000'].describe(percentiles=percentiles))


def read_csv_into_df(csv_path):
  df = pandas.read_csv(csv_path, sep=',', header=0)
  return df


def main(argv):
  csv_path = FLAGS.csv_path
  assert csv_path, '--csv_path must be specified.'

  feed_stats_df = read_csv_into_df(csv_path)
  simple_stats_and_print(feed_stats_df)

  return 0


if __name__ == '__main__':
  flags.DEFINE_string('csv_path', None, 'Intput csv file path.')

  app.run(main)
